home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / LColorPicker / LColorPicker.h < prev    next >
Encoding:
Text File  |  1995-08-27  |  1.6 KB  |  62 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        LColorPicker.h
  3.  
  4.     Contains:    Support for modeless and movable modal color pickers.
  5.                             
  6.     Written by: Chris Thomas
  7.  
  8.     Copyright:    © 1995 Chris K. Thomas. All Rights Reserved.
  9.     
  10.     Documentation in .cp.
  11.  */
  12.  
  13. // * comment out this line if not using PowerPlant
  14. // * our you don't want this class to be LSharable
  15. #include <PP_Prefix.h>
  16.  
  17. #include <ColorPicker.h>
  18.  
  19. #if (defined __PowerPlant__)
  20. #include <LSharable.h>
  21. #endif
  22.  
  23. class LColorPicker
  24. #if (defined __PowerPlant__)
  25. : public LSharable
  26. #endif
  27. {
  28.     RGBColor                mCurrentColor;
  29.     picker                    mPicker;        // * 2.0 Picker
  30.     GrafPtr                    mSavePort;
  31.     
  32.     static ColorChangedUPP    sColorChangeUpp;
  33.     
  34. public:
  35.                             LColorPicker(StringPtr inPrompt, RGBColor& inOldColor,
  36.                                             Boolean isMovable, Boolean isModal);
  37.     virtual                    ~LColorPicker();
  38.     
  39.     // * accessors
  40.     void                    SetColor(RGBColor &inColor, ColorType inColorType);
  41.     void                    GetColor(RGBColor &outColor);
  42.     void                    SetPrompt(const StringPtr inPrompt);
  43.     
  44.     // * events
  45.     short                    HandleEvent(EventRecord *inEvent);
  46.         
  47.         // * call before deleting. if not, don't delete.
  48.     Boolean                    CanClose();    
  49.     
  50. protected:
  51.  
  52.     // * subclass overrides for 2.0
  53.     virtual void    GetMenuItems(PickerMenuItemInfo &outInfo) {};
  54.     
  55.     virtual void    UserChangingColor() {}    // called live when user changes a color
  56.     virtual void    UserFinalizedColor() {}    // called when user finalizes a color change
  57.     virtual void    UserSaysOK() {}            // user hit OK
  58.     virtual void    UserSaysCancel() {}        // user hit Cancel
  59.     
  60.     // * callback proc->method tranforms
  61.     static pascal void ColorChangeProc(LColorPicker *inInstance, PMColor *inNewColor);
  62. };